package com.neusoft;

import java.io.UnsupportedEncodingException;
import java.util.UUID;

public class DemoString {

	public static void main(String[] args) {
//		String s = "abcdefg";
//		char[] charArray = s.toCharArray();
//		for (char c : charArray) {
//			System.out.println(c);
//		}
//		
//		String s1 = "hello";
//		String s2 = new String("Hello");
//		s2 = "ggg";
//		s1 = "dddd";
//		System.out.println(s1);
//		System.out.println(s2);
//		
//		String s3 = "456";
//		byte[] bytes =	 s3.getBytes();
//		for (byte b : bytes) {
//			System.out.println(b);
//		}
		
		String s4 = "abd33-def21-oiu96-ytr45";
		//使用util包下的  UUID工具类 生成随机的字符串  常用场景:文件上传中的文件名进行设置
		//toString方法:作用是将int类型转换为对应的String类型。
		System.out.println(UUID.randomUUID().toString());
		String[] split = s4.split("-");
		for (String s : split) {
			System.out.println(s);
		}
		
		String replace = s4.replace('d', 'Z');
		System.out.println(replace);
		
		String replaceAll = s4.replaceAll("33", "hh");
		System.out.println(replaceAll);
		
		System.out.println(s4.toUpperCase());
		
		String s5 = "ABCGDEAFGD";
		System.out.println(s5.toLowerCase());
		
		System.out.println(s5.charAt(3));
		
		System.out.println(s5.substring(3, 6));
		
		System.out.println(s5.indexOf("GD"));
		
		System.out.println(s5.lastIndexOf("GD"));
		
		String s6 ="  a bcde f   ";
		System.out.println(s6.trim());
		System.out.println(s6.length());
		
		String s7 = "hello";
		String s8 = "world";
		System.out.println(s7.concat(s8));
		
		
		String s9 = "hELlo";
		
		System.out.println(s7.equals(s9));
		System.out.println(s7.equalsIgnoreCase(s9));
		
		String s10 = "fdjshfkjhlkfdsf";
		System.out.println(s10.startsWith("fdg"));
		System.out.println(s10.endsWith("sf"));
		
	}
}
